package top.lingchen.spring5.testdemo;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import top.lingchen.spring5.bean.Emp;
import top.lingchen.spring5.service.UserService;

/**
 * @Author 凌宸
 * @create 2021-11-28 下午 6:03
 * @Description
 * @Version 1.0
 */
public class TestBean {
    @Test
    public void testUserService(){
        ApplicationContext con = new ClassPathXmlApplicationContext("bean2.xml");
        UserService userService = con.getBean("userService", UserService.class);
        System.out.println(userService);
        userService.add();
        /**
         * top.lingchen.spring5.service.UserService@cb0ed20
         * service add ....
         * dao update ...
         */
    }

    @Test
    public void testInnerBean(){
        ApplicationContext con = new ClassPathXmlApplicationContext("bean4.xml");
        Emp emp = con.getBean("emp", Emp.class);
        System.out.println(emp); // Emp{EmpName='Curry', gender='男', dept=Dept{deptName='安保部'}}
    }
}
